import request from "@/request/request";
import qs from "qs"

 
export function getCategoryList(data){
    let url = "/admin/category";
    let param = {
        url:url,
        method:"GET",
        params:data
    }
    return request(param);
}



export function saveCategory(id,category){
    let method = "post";
    let url = "/admin/category";
    if(id){
        method = "put";
        url = "/admin/category/"+id;
    }

    let param = {
        url:url,
        method:method,
        data:qs.stringify(category)
    }
    return request(param);
}


export function deleteCategoryById(id){
    let param = {
        url:"/admin/category/"+id,
        method:"delete"
    }
    return request(param);
}


export function updateStatus(id,status){
    let param = {
        url:"/admin/category/"+id+"/status",
        method:"put",
        data:"status="+status
    }
    return request(param);
}






